package com.jw.qiliprj.maintab.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter

import com.cysd.ewmxns.sdw_ui.fragment.Sdw_IndexFragment
import com.cysd.ewmxns.sdw_ui.fragment.Sdw_QrCodeFragment
import com.cysd.ewmxns.sdw_ui.fragment.Sdw_WodeFragment


// ViewPagerAdapter.kt
class ViewPagerAdapter(fragmentActivity: FragmentActivity) : FragmentStateAdapter(fragmentActivity) {

    override fun getItemCount(): Int {
        return 3
    }

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0 -> Sdw_IndexFragment()
            1 -> Sdw_QrCodeFragment()
            2 -> Sdw_WodeFragment()
            else -> throw IllegalArgumentException("Invalid position")
        }
    }
}